<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Module: Chef::Knife::GithubBaseList

    &mdash; Knife Github utilities

</title>

  <link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '../../';
  framesUrl = "../../frames.html#!" + escape(window.location.href);
</script>


  <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">

    <a href="../../_index.html">Index (G)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../../Chef.html" title="Chef (class)">Chef</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Knife.html" title="Chef::Knife (class)">Knife</a></span></span>
     &raquo;
    <span class="title">GithubBaseList</span>


  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">

    <a class="full_list_link" id="class_list_link"
        href="../../class_list.html">
      Class List
    </a>

    <a class="full_list_link" id="method_list_link"
        href="../../method_list.html">
      Method List
    </a>

    <a class="full_list_link" id="file_list_link"
        href="../../file_list.html">
      File List
    </a>

</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><h1>Module: Chef::Knife::GithubBaseList



</h1>

<dl class="box">








    <dt class="r1 last">Defined in:</dt>
    <dd class="r1 last">lib/chef/knife/github_baselist.rb</dd>

</dl>
<div class="clear"></div>









    <h2>
      Class Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">

        <li class="public ">
  <span class="summary_signature">

      <a href="#included-class_method" title="included (class method)">+ (Object) <strong>included</strong>(includer) </a>



  </span>









    <span class="summary_desc"><div class='inline'></div></span>

</li>


    </ul>




  <div id="class_method_details" class="method_details_list">
    <h2>Class Method Details</h2>


      <div class="method_details first">
  <h3 class="signature first" id="included-class_method">

    + (<tt>Object</tt>) <strong>included</strong>(includer)





</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/chef/knife/github_baselist.rb', line 26</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_included'>included</span><span class='lparen'>(</span><span class='id identifier rubyid_includer'>includer</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_includer'>includer</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='kw'>do</span>

    <span class='id identifier rubyid_option'>option</span> <span class='symbol'>:fields</span><span class='comma'>,</span>
           <span class='symbol'>:long</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--fields 'NAME, NAME'</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
           <span class='symbol'>:description</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The fields to output, comma-separated</span><span class='tstring_end'>&quot;</span></span>

    <span class='id identifier rubyid_option'>option</span> <span class='symbol'>:fieldlist</span><span class='comma'>,</span>
           <span class='symbol'>:long</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--fieldlist</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
           <span class='symbol'>:description</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The available fields to output/filter</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
           <span class='symbol'>:boolean</span> <span class='op'>=&gt;</span> <span class='kw'>true</span>

    <span class='id identifier rubyid_option'>option</span> <span class='symbol'>:noheader</span><span class='comma'>,</span>
           <span class='symbol'>:long</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--noheader</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
           <span class='symbol'>:description</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Removes header from output</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
           <span class='symbol'>:boolean</span> <span class='op'>=&gt;</span> <span class='kw'>true</span>

    <span class='kw'>def</span> <span class='id identifier rubyid_display_info'>display_info</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_columns'>columns</span><span class='comma'>,</span> <span class='id identifier rubyid_match'>match</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
      <span class='id identifier rubyid_object_list'>object_list</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>

      <span class='kw'>if</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:fields</span><span class='rbracket'>]</span>
        <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:fields</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>,</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_n'>n</span><span class='op'>|</span> <span class='id identifier rubyid_object_list'>object_list</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_n'>n</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_capitalize'>capitalize</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='comma'>,</span> <span class='symbol'>:bold</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
      <span class='kw'>else</span>
        <span class='id identifier rubyid_columns'>columns</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span> <span class='id identifier rubyid_r'>r</span> <span class='op'>=</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='id identifier rubyid_object_list'>object_list</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='comma'>,</span> <span class='symbol'>:bold</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
      <span class='kw'>end</span>

      <span class='id identifier rubyid_col'>col</span> <span class='op'>=</span> <span class='id identifier rubyid_object_list'>object_list</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span>
      <span class='id identifier rubyid_object_list'>object_list</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:noheader</span><span class='rbracket'>]</span>

      <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
        <span class='kw'>if</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:fields</span><span class='rbracket'>]</span>
           <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:fields</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>,</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_n'>n</span><span class='op'>|</span> <span class='id identifier rubyid_object_list'>object_list</span> <span class='op'>&lt;&lt;</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_n'>n</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>n/a</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span>
        <span class='kw'>else</span>
          <span class='id identifier rubyid_color'>color</span> <span class='op'>=</span> <span class='symbol'>:white</span>
          <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_match'>match</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:all</span><span class='rbracket'>]</span>
            <span class='id identifier rubyid_matches'>matches</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='semicolon'>;</span> <span class='id identifier rubyid_match'>match</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_m'>m</span><span class='op'>|</span> <span class='id identifier rubyid_matches'>matches</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='id identifier rubyid_m'>m</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='rbrace'>}</span>
            <span class='kw'>if</span> <span class='id identifier rubyid_matches'>matches</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>==</span> <span class='int'>1</span>
              <span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:mismatch</span><span class='rbracket'>]</span>
            <span class='kw'>else</span>
              <span class='id identifier rubyid_color'>color</span> <span class='op'>=</span> <span class='symbol'>:yellow</span>
            <span class='kw'>end</span>
          <span class='kw'>end</span>
          <span class='id identifier rubyid_columns'>columns</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span>  <span class='id identifier rubyid_r'>r</span> <span class='op'>=</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='id identifier rubyid_object_list'>object_list</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='id identifier rubyid_color'>color</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>n/a</span><span class='tstring_end'>'</span></span> <span class='rbrace'>}</span>
        <span class='kw'>end</span>
      <span class='kw'>end</span>

      <span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_list'>list</span><span class='lparen'>(</span><span class='id identifier rubyid_object_list'>object_list</span><span class='comma'>,</span> <span class='symbol'>:uneven_columns_across</span><span class='comma'>,</span> <span class='id identifier rubyid_col'>col</span><span class='rparen'>)</span>
      <span class='id identifier rubyid_display_object_fields'>display_object_fields</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='symbol'>:fieldlist</span><span class='rparen'>)</span>
    <span class='kw'>end</span>

    <span class='kw'>def</span> <span class='id identifier rubyid_display_object_fields'>display_object_fields</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span>
      <span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span> <span class='kw'>if</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
      <span class='id identifier rubyid_object_fields'>object_fields</span> <span class='op'>=</span> <span class='lbracket'>[</span>
        <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Key</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:bold</span><span class='rparen'>)</span><span class='comma'>,</span>
        <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Type</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:bold</span><span class='rparen'>)</span><span class='comma'>,</span>
        <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Value</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:bold</span><span class='rparen'>)</span>
       <span class='rbracket'>]</span>
       <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_n'>n</span><span class='op'>|</span>
        <span class='kw'>if</span> <span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>==</span> <span class='const'>Hash</span>
          <span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
            <span class='id identifier rubyid_object_fields'>object_fields</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='symbol'>:yellow</span><span class='comma'>,</span> <span class='symbol'>:bold</span><span class='rparen'>)</span>
            <span class='id identifier rubyid_object_fields'>object_fields</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_n'>n</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
            <span class='kw'>if</span> <span class='id identifier rubyid_n'>n</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span><span class='lparen'>(</span><span class='const'>Array</span><span class='rparen'>)</span>
              <span class='id identifier rubyid_object_fields'>object_fields</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>&lt;Array&gt;</span><span class='tstring_end'>'</span></span>
            <span class='kw'>elsif</span> <span class='id identifier rubyid_n'>n</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
              <span class='id identifier rubyid_object_fields'>object_fields</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>&lt;Hash&gt;</span><span class='tstring_end'>'</span></span>
            <span class='kw'>else</span>
              <span class='id identifier rubyid_object_fields'>object_fields</span> <span class='op'>&lt;&lt;</span> <span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_n'>n</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
            <span class='kw'>end</span>
          <span class='kw'>end</span>
        <span class='kw'>end</span>
      <span class='kw'>end</span>
      <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span>
      <span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_list'>list</span><span class='lparen'>(</span><span class='id identifier rubyid_object_fields'>object_fields</span><span class='comma'>,</span> <span class='symbol'>:uneven_columns_across</span><span class='comma'>,</span> <span class='int'>3</span><span class='rparen'>)</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>

  </div>

</div>

    <div id="footer">
  Generated on Wed Oct 30 21:59:25 2013 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.7.2 (ruby-1.9.3).
</div>

  </body>
</html>